var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
// TODO: Add Types
import { categorizeFiles } from '@mintlify/prebuild';
import fse from 'fs-extra';
import { join } from 'path';
import { CLIENT_PATH, CMD_EXEC_PATH } from '../../constants.js';
import { generateNav } from './generate.js';
// TODO: Put in prebuild package
export const updateGeneratedNav = () => __awaiter(void 0, void 0, void 0, function* () {
    const generatedNav = yield generateNav();
    const targetPath = join(CLIENT_PATH, 'src', '_props', 'generatedNav.json');
    yield fse.outputFile(targetPath, JSON.stringify(generatedNav, null, 2), {
        flag: 'w',
    });
});
export const updateOpenApiFiles = () => __awaiter(void 0, void 0, void 0, function* () {
    const { openApiFiles } = yield categorizeFiles(CMD_EXEC_PATH);
    const targetPath = join(CLIENT_PATH, 'src', '_props', 'openApiFiles.json');
    yield fse.outputFile(targetPath, JSON.stringify(openApiFiles, null, 2), {
        flag: 'w',
    });
});
